﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using Microsoft.Practices.Prism.Logging;
using Microsoft.Practices.Prism.Modularity;
using Microsoft.Practices.Prism.Mvvm;
using Microsoft.Practices.Prism.UnityExtensions;
using Microsoft.Practices.ServiceLocation;
using Microsoft.Practices.Unity;

namespace FM.播音.管理
{
    public class 启动器 : UnityBootstrapper
    {
        protected override DependencyObject CreateShell()
        {
            var 视图1 = ServiceLocator.Current.GetInstance<Views.主窗口>();
            return 视图1;
        }

        protected override void InitializeShell()
        {
            base.InitializeShell();
            Application.Current.MainWindow = (Window)Shell;
            var view = Shell as IView;
            if (view != null)
            {
                view.LoadViewModel();
            }
            Application.Current.MainWindow.Show();
        }

        protected override IModuleCatalog CreateModuleCatalog()
        {

            var 模块管理中心 = new ModuleCatalog();
            return 模块管理中心;
        }

        protected override void ConfigureContainer()
        {
            base.ConfigureContainer();
            Container.RegisterType<ILoggerFacade, NLog日志>(new ContainerControlledLifetimeManager());
        }




        protected override void ConfigureModuleCatalog()
        {
            base.ConfigureModuleCatalog();
            小冰.Set默认解析器();
            var moduleCatalog = (ModuleCatalog)this.ModuleCatalog;
            moduleCatalog.AddModule(typeof(启动模块));
        }
    }
}
